package de.koller.enc.render;

import de.koller.enc.ENode;
import de.koller.oceanFramework.math.Vec;
import org.lwjgl.opengl.GL11;

public class Camera extends ENode {
	
	private final float scale = 32;
	private final Vec cameraPos = new Vec();
	
	@Override
	protected void update( int elapsedTime ) {
		super.update( elapsedTime );
		
		if( eroot.input.isMouseDown( 1 ) )
			cameraPos.add( eroot.input.getMouseDX(), eroot.input.getMouseDY() );
	}
	
	public void preTransform() {
		GL11.glPushMatrix();
		GL11.glTranslatef( cameraPos.getXf(), cameraPos.getYf(), 0 );
		GL11.glScalef( scale, scale, 1 );
	}
	
	public void postTransform() {
		GL11.glPopMatrix();
	}

	public float getScale() {
		return scale;
	}
	
	public float getcx() {
		return cameraPos.getXf();
	}
	
	public float getcy() {
		return cameraPos.getYf();
	}
	
}
